// interface P{
//     name:number;
//     age:string;
//     sex:number;
//     sayHello():void;
// }
interface S {
    id:number;
    name:string;
    age:number;
    sex:string;
    sayHello():void;
}
interface C {
    id:number;
    name:string;
    age:number;
    sayHi():void; 
}
//接口继承，属性多的接口继承属性少的接口，属性多的可以覆盖属性少的,
//当属性名相同，类型不同时，接口继承就会报错，
interface S extends C{  

}
//错误继承实例
// interface C extends P{
//     sayHi():void;
// }
class S1 implements S{
    id:number;
    name:string;
    age:number;
    sex:string;
    constructor(id:number,name:string,age:number,sex:string){
        this.id=id;
        this.name=name;
        this.age=age;
        this.sex=sex;
    }
    sayHello(): void {
        console.log(`Hello,my id is ${this.id}  name is ${this.name} and I am ${this.age} years old.`); 
    }
    sayHi(): void {
        console.log(`Hi,my id is ${this.id}  name is ${this.name} and I am ${this.age} years old.`); 
    }
}
let s1=new S1(1,'Jack',18,'male');
s1.sayHello();//Hello,my id is 1  name is Jack and I am 18 years old.